In [1]:
import cv2
In [2]:
import matplotlib.pyplot as plt
In [3]:
shooter = cv2.imread('demo1.jpg', cv2.IMREAD_GRAYSCALE)
In [4]:
nature = cv2.imread('nature.jpg', cv2.IMREAD_GRAYSCALE)
In [5]:
plt.figure(figsize=(20,15))
Out[5]:
In [6]:
plt.subplot(1,2,1)
Out[6]:
In [7]:
plt.title('Shooter')
Out[7]:
In [8]:
plt.imshow(shooter, cmap='gray')
Out[8]:
In [9]:
plt.subplot(1,2,2)
Out[9]:
In [10]:
plt.title('Nature')
Out[10]:
In [11]:
plt.imshow(nature, cmap='gray')
Out[11]:
In [12]:
plt.show()
In [13]:
img = shooter - nature
In [14]:
plt.imshow(img, cmap='gray')
Out[14]:
In [15]:
plt.show()
In [16]:
img_abs = cv2.absdiff(shooter, nature)
In [17]:
plt.imshow(img_abs, cmap='gray')
Out[17]:
In [18]:
plt.show()